package com.swak.vertx.invoker.mark;

import com.swak.annotation.Cache;

/**
 * 使用缓存的标识
 * 
 * @author lifeng
 */
public class HasCacheMark implements CacheMark {

	private final Cache cache;
	private final int index;

	public HasCacheMark(Cache cache) {
		this.cache = cache;
		this.index = -1;
	}

	public HasCacheMark(Cache cache, int index) {
		this.cache = cache;
		this.index = index;
	}

	public int index() {
		return index;
	}

	@Override
	public String name() {
		return this.cache.name();
	}

	@Override
	public int paramValueForName() {
		return this.cache.paramValueForName();
	}

	@Override
	public boolean cachedResult() {
		return this.cache.cachedResult();
	}

	@Override
	public int timeToIdle() {
		return 0;
	}
}
